package com.compty.paint.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 图像数据
 * @author zhuqh
 *
 */
@Entity
@Table(name = "t_imageinfo_data")
public class PhotoData {

	private Long id ;
	
	private byte[] data;
	
	private ImageInfo imageInfo;
	
	public PhotoData() {
		super();
	}

	public PhotoData(byte[] data) {
		super();
		this.data = data;
	}

	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Lob
	@Column(name="data",columnDefinition = "BLOB")
	public byte[] getData() {
		return data;
	}

	public void setData(byte[] data) {
		this.data = data;
	}

	@OneToOne(fetch= FetchType.LAZY,mappedBy="photo" )
	public ImageInfo getImageInfo() {
		return imageInfo;
	}

	public void setImageInfo(ImageInfo imageInfo) {
		this.imageInfo = imageInfo;
	}
	
}
